package arsmodeller.commands;

import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.gef.commands.Command;

import arsmodeller.model.BusinessProcess;

public class BusinessProcessChangeLayoutCommand extends AbstractLayoutCommand {
	private BusinessProcess model;
	private Rectangle layout;
	private Rectangle oldLayout;

	public void execute() {
		model.setLayout(layout);
	}

	public void setConstraint(Rectangle rect) {
		this.layout = rect;
	}

	public void setModel(Object model) {
		this.model = (BusinessProcess) model;
		this.oldLayout = ((BusinessProcess) model).getLayout();
	}

	public void undo() {
		this.model.setLayout(this.oldLayout);
	}

	public void setLayout(Rectangle r) {
		if (model == null)
			return;
		model.setLayout(r);
	}

}
